package im.vinci.server.syncdb.controller;

import im.vinci.server.security.ApiSecurityLabel;
import im.vinci.server.syncdb.domain.HistoryPlayCount;
import im.vinci.server.syncdb.service.UserDataSyncService;
import im.vinci.server.utils.apiresp.ResultObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.websocket.server.PathParam;

/**
 * Created by mingjie on 17/2/21.
 */
@RestController
@RequestMapping(value = "/vinci/history", produces = "application/json;charset=UTF-8")
public class VinciHistoryController {

    @Autowired
    private UserDataSyncService userDataSyncService;

    @RequestMapping(value = "/play/{user_id}", method = RequestMethod.GET)
    @ApiSecurityLabel
    public ResultObject<HistoryPlayCount> getUserData(@PathVariable("user_id") long userId) {
        return new ResultObject<>(userDataSyncService.getUserHistoryPlayCount(userId));
    }
}
